adding a nsbuttoncell to a tableview programmatically in objc

I tried doing the outlets for all the controls, then making a nsview in the method for a button that declares a view, then I set initwithframe to be sent to a variable typed 'id' and accessing that variable I was able to add nsbuttoncell to the variable, then I added the subview to the. main tableview

here's the code I used:

NSView *viewptr = [[NSView alloc]init];
NSButtonCell *bCell1 = [[NSButtonCell alloc]init];
NSRect rect;

[bCell1 setTitle:@"click"];

rect.size.width = 2;
rect.size.height = 1;
id temp,x;
temp = [viewptr initWithFrame:rect];
[temp addObject:bCell1];
[_cocoa_test_scrollview addSubview:temp];

is there anything im missing? the app keeps crashing and spiting out debug messages, like:

-[NSView addObject:]: unrecognized selector sent to instance 0x12ee0ae60 ( 0 CoreFoundation 0x0000000186efaccc __exceptionPreprocess + 176 1 libobjc.A.dylib 0x00000001869e2788 objc_exception_throw + 60 2 CoreFoundation 0x0000000186fad02c -[NSObject(NSObject) __retain_OA] + 0 3 CoreFoundation 0x0000000186e64cdc forwarding + 1580 4 CoreFoundation 0x0000000186e645f0 _CF_forwarding_prep_0 + 96 5 objc_cocoa_test_image_3 0x0000000100608ca4 -[AppDelegate cocoa_test_button1_add:] + 264 6 AppKit 0x000000018a881c70 -[NSApplication(NSResponder) sendAction:to:from:] + 460 7 AppKit 0x000000018a881a74 -[NSControl sendAction:to:] + 72 8 AppKit 0x000000018a8819b8 __26-[NSCell _sendActionFrom:]_block_invoke + 100 9 AppKit 0x000000018a8818e0 -[NSCell _sendActionFrom:] + 204 10 AppKit 0x000000018a881804 -[NSButtonCell _sendActionFrom:] + 88 11 AppKit 0x000000018a87ee38 NSControlTrackMouse + 1480 12 AppKit 0x000000018a87e844 -[NSCell trackMouse:inRect:ofView:untilMouseUp:] + 144 13 AppKit 0x000000018a87e6fc -[NSButtonCell trackMouse:inRect:ofView:untilMouseUp:] + 488 14 AppKit 0x000000018a87dbd0 -[NSControl mouseDown:] + 448 15 AppKit 0x000000018a87c99c -[NSWindow(NSEventRouting) _handleMouseDownEvent:isDelayedEvent:] + 3472 16 AppKit 0x000000018a807f78 -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 364 17 AppKit 0x000000018a807c38 -[NSWindow(NSEventRouting) sendEvent:] + 284 18 AppKit 0x000000018aecde70 -[NSApplication(NSEventRouting) sendEvent:] + 1604 19 AppKit 0x000000018ab1b8cc -[NSApplication _handleEvent:] + 60 20 AppKit 0x000000018a6cfcdc -[NSApplication run] + 512 21 AppKit 0x000000018a6a6f54 NSApplicationMain + 880 22 objc_cocoa_test_image_3 0x0000000100608a68 main + 60 23 dyld 0x0000000186a1e0e0 start + 2360 )

can anyone point me in the right direction?

Please post a full crash report, per the instructions in Posting a Crash Report.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

adding a nsbuttoncell to a tableview programmatically in objc
 
 
Q